<template>
  <div style="margin-left: 70px;">
    <el-tooltip class="item" effect="dark" content="刷新" placement="top">
      <el-button circle icon="Refresh" @click="update" />
    </el-tooltip>
  </div>
  <el-table :data="WaitAssessorList" style="width: 90%;border-radius: 8px; margin: 20px auto;box-shadow: 5px 5px 10px rgba(64, 158, 255, 0.5);" 
  size="large"
  :header-cell-style="{
      background: '#337ecc !important',
      color: '#ffffff',
      border: 'none !important',
      textAlign: 'center',
    }">
    <el-table-column prop="empName" label="员工姓名" width="150" ></el-table-column>
    <el-table-column prop="position" label="岗位" width="180"></el-table-column>
    <el-table-column prop="deptName" label="所属单元" width="180" />
    <el-table-column label="操作">
      <template #default="scope">
        <el-button 
        type="success"
         @click="onShowClick(scope.$index, scope.row)"
          >查看详情</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>


<script setup>
import {ref, onMounted,onBeforeMount, reactive,watch} from "vue";
import { Timer } from '@element-plus/icons-vue';
import {useRouter} from "vue-router";
import {getThird} from '@/api/person'
import { ElMessage } from 'element-plus'

const router = useRouter()

const WaitAssessorList=ref([])
let assessorId=JSON.parse(localStorage.getItem('userInfo')).id;
onBeforeMount(()=>{
    getThird({assessorId})
    .then(data=>{
      WaitAssessorList.value=data.data;
    });
})

const onShowClick =(index, row) => {
  router.push({
    path: '/person/thirdDetail',
	query: row,
  })
}

const update=()=>{
  getThird({assessorId})
    .then(data=>{
      if(data.code==200){
      ElMessage({
        message: '更新成功',
        type: 'success',
      })
      WaitAssessorList.value=data.data;
    }
    });
}

</script>

<style lang="scss" scoped>
.step{
  width: 1000px;
  margin-left: 20px auto;
}
</style>
